The present invention relates to the display and printing of font characters, and more particularly to a method and system for representing color and/or other attributes as components of the bitmap glyph images that characterize a font.
Many different types of computer application programs, such as desktop publishing programs, word processing programs, graphic design programs, and web page authoring programs, provide the capability for users to display text in a number of different manners, to provide a variety of different effects. For instance, users can control the appearance of the text by selecting different fonts, as well as various characteristics of the text, including its size, style, weight and the like. Many of these characteristics are included within the definition of a font. For instance, a font might contain one set of character images, or glyphs, for plain text, another set of glyphs for bold text, and yet another set of glyphs for italicized text.
Another attribute of text, which can be employed with great effectiveness to create different impressions, is its color. For instance, individual words in a document can be printed in bold colors, such as red or blue, to draw the reader""s attention to a specific concept. In another context, a variety of colors can be used for different portions of text, to create fanciful presentations. In the past, color did not form a component of a font definition itself. Rather, the individual glyphs of a font were defined as monochrome images. For instance, one approach that is employed to define glyph images employs a bitmap of the image. In this approach, each pixel of an image is defined as being xe2x80x9conxe2x80x9d or xe2x80x9coffxe2x80x9d. When the image of a character is to be displayed on a computer monitor or printed on paper, the xe2x80x9conxe2x80x9d pixels are displayed or printed with a designated foreground color, e.g. black, and the xe2x80x9coffxe2x80x9d pixels are not printed, or are displayed as a background color, to thereby form the image of a character. To change the color of the character, the designated foreground color is varied. Thus, for example, if the new foreground color is designated as red, the entire character appears in the color red, rather than black.
An alternative approach to defining the glyphs of a font is to characterize them by their geometric shapes. In this approach, the outline of the font is defined, for example by mathematical formulas. When the character is to be displayed, the area within the defined outline is filled with the foreground color. In a similar manner, the color of the character can be changed, by designating a different foreground color.
To provide greater versatility in the appearance of glyphs, it is desirable to employ multiple colors within the image of a single character or symbol. For example, it may be desirable to display one or more edges of a character in a color that contrasts with the main color of the character, to create a shadow effect. In another situation, it may be desirable to display or print a glyph in a pattern of colors that represent the colors of a country""s flag, or other symbolic image. One technique that permits the glyphs of an outline font to be displayed with multiple colors is disclosed in copending application Ser. No. 09/016,671, commonly assigned herewith. In the technique disclosed therein, different components of the outline can be defined in respective layers, and each layer can be displayed in a different color.
For bitmapped fonts, it is possible to designate different colors by employing multiple bits for each pixel of the glyph image. However, such an approach can significantly increase the amount of data that is required to define the font. For instance, in a system which is capable of displaying up to 256 different colors, 8 bits are required to uniquely designate any given color. It will be appreciated that, if 8 bits are required to define each pixel within each glyph of the font, the amount of memory required to store the font will become excessive.
Accordingly, it is desirable to provide a technique which permits colors and other multi-valued attributes of glyphs to be defined within bitmapped font images, but which does so with a limited amount of data, to thereby minimize storage requirements.
In accordance with the present invention, colors and other multi-valued attributes are specified within the individual glyphs of a font through an indirect approach, to thereby permit each glyph to be defined with a limited amount of data. This indirect approach is implemented through the use of multiple tables. The data values for the individual pixels of a glyph identify entries in an index table that is associated with one or more glyphs. The entries in the index table map to a table which is universal to all of the glyphs and contains all of the values of a particular attribute of the glyphs. If the attribute is color, the table contains entries which respectively correspond to all of the colors that are employed within the font.
By means of this approach, the amount of data that is required for any particular glyph can be minimized. For example, if a glyph contains a maximum of four colors, each pixel of the glyph only requires two bits to define its color. Another glyph which employs a different set of four colors also can be defined with two bits per pixel. The index tables specify the mapping of the two-bit pixel values for the individual glyphs to the various colors specified in the universal color table. Hence, even if the color table specifies a total of 256 different colors, each glyph only requires two bits per pixel, rather than eight bits per pixel, thereby keeping the size of the font data to a minimum.
Furthermore, each index table only needs to be large enough to accommodate an arbitrary number of colors, rather than being confined to a number of entries which are equal to a power of two. This flexibility in the size of the index table further permits the amount of font data to be kept to a minimum.
As an additional advantage of the invention, the color table can define the colors in a device-independent manner. As a result, the color table can be shared between outline fonts and bitmapped fonts, rather than being limited solely to use by a bitmapped font.
Further features of the invention, and the advantages provided thereby, are described in greater detail hereinafter with reference to embodiments thereof illustrated in the accompanying drawings.